Crate ego_tree

source ·
Expand description

Vec-backed ID-tree.

§Behavior

  • Trees have at least a root node;
  • Nodes have zero or more ordered children;
  • Nodes have at most one parent;
  • Nodes can be detached (orphaned) but not removed;
  • Node parent, next sibling, previous sibling, first child and last child can be accessed in constant time;
  • All methods perform in constant time;
  • All iterators perform in linear time.

§Examples

let mut tree = ego_tree::Tree::new('a');
let mut root = tree.root_mut();
root.append('b');
let mut c = root.append('c');
c.append('d');
c.append('e');
#[macro_use] extern crate ego_tree;
let tree = tree!('a' => { 'b', 'c' => { 'd', 'e' } });

Modules§

Macros§

  • Creates a tree from expressions.

Structs§